<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>transwarp: transwarp::task_pool&lt; ResultType &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">transwarp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacetranswarp.html">transwarp</a></li><li class="navelem"><a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classtranswarp_1_1task__pool-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">transwarp::task_pool&lt; ResultType &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A task pool that allows running multiple instances of the same task in parallel.  
 <a href="classtranswarp_1_1task__pool.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="transwarp_8h_source.html">transwarp.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3d3687ec02b1731726da28a51742c5f1"><td class="memItemLeft" align="right" valign="top"><a id="a3d3687ec02b1731726da28a51742c5f1"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a3d3687ec02b1731726da28a51742c5f1">task_pool</a> (std::shared_ptr&lt; <a class="el" href="classtranswarp_1_1task.html">transwarp::task</a>&lt; ResultType &gt;&gt; <a class="el" href="classtranswarp_1_1task.html">task</a>, std::size_t <a class="el" href="classtranswarp_1_1task__pool.html#a00cfcbc2ddc5054dc07e7ef1eabdcce1">minimum_size</a>, std::size_t <a class="el" href="classtranswarp_1_1task__pool.html#af10a82a436ba698b6b3435766f16d6be">maximum_size</a>)</td></tr>
<tr class="memdesc:a3d3687ec02b1731726da28a51742c5f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a task pool. <br /></td></tr>
<tr class="separator:a3d3687ec02b1731726da28a51742c5f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a278ecb00c1b7c463ffe30fdd670192c1"><td class="memItemLeft" align="right" valign="top"><a id="a278ecb00c1b7c463ffe30fdd670192c1"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a278ecb00c1b7c463ffe30fdd670192c1">task_pool</a> (std::shared_ptr&lt; <a class="el" href="classtranswarp_1_1task.html">transwarp::task</a>&lt; ResultType &gt;&gt; <a class="el" href="classtranswarp_1_1task.html">task</a>)</td></tr>
<tr class="memdesc:a278ecb00c1b7c463ffe30fdd670192c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a task pool with reasonable defaults for minimum and maximum. <br /></td></tr>
<tr class="separator:a278ecb00c1b7c463ffe30fdd670192c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae86e25182929d4cceec1e32e3d4108e3"><td class="memItemLeft" align="right" valign="top"><a id="ae86e25182929d4cceec1e32e3d4108e3"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>task_pool</b> (const <a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;)=delete</td></tr>
<tr class="separator:ae86e25182929d4cceec1e32e3d4108e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a21ebafa4f71b704e919e861b0509c7b1"><td class="memItemLeft" align="right" valign="top"><a id="a21ebafa4f71b704e919e861b0509c7b1"></a>
<a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>operator=</b> (const <a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;)=delete</td></tr>
<tr class="separator:a21ebafa4f71b704e919e861b0509c7b1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2885d85b6f266a7e1334e58d95b630ff"><td class="memItemLeft" align="right" valign="top"><a id="a2885d85b6f266a7e1334e58d95b630ff"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>task_pool</b> (<a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;&amp;)=delete</td></tr>
<tr class="separator:a2885d85b6f266a7e1334e58d95b630ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeea5c7344ad083acc2e7b127f2a677c5"><td class="memItemLeft" align="right" valign="top"><a id="aeea5c7344ad083acc2e7b127f2a677c5"></a>
<a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>operator=</b> (<a class="el" href="classtranswarp_1_1task__pool.html">task_pool</a> &amp;&amp;)=delete</td></tr>
<tr class="separator:aeea5c7344ad083acc2e7b127f2a677c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35715200815a797bc2bd191015490414"><td class="memItemLeft" align="right" valign="top"><a id="a35715200815a797bc2bd191015490414"></a>
std::shared_ptr&lt; <a class="el" href="classtranswarp_1_1task.html">transwarp::task</a>&lt; ResultType &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a35715200815a797bc2bd191015490414">next_task</a> (bool maybe_resize=true)</td></tr>
<tr class="memdesc:a35715200815a797bc2bd191015490414"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the next idle task. If there are no idle tasks then it will attempt to double the pool size. If that fails then it will return a nullptr. On successful retrieval of an idle task the function will mark that task as busy. <br /></td></tr>
<tr class="separator:a35715200815a797bc2bd191015490414"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab16759130d189765b67679239cc84401"><td class="memItemLeft" align="right" valign="top"><a id="ab16759130d189765b67679239cc84401"></a>
std::shared_ptr&lt; <a class="el" href="classtranswarp_1_1task.html">transwarp::task</a>&lt; ResultType &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#ab16759130d189765b67679239cc84401">wait_for_next_task</a> (bool maybe_resize=true)</td></tr>
<tr class="memdesc:ab16759130d189765b67679239cc84401"><td class="mdescLeft">&#160;</td><td class="mdescRight">Just like <a class="el" href="classtranswarp_1_1task__pool.html#a35715200815a797bc2bd191015490414" title="Returns the next idle task. If there are no idle tasks then it will attempt to double the pool size....">next_task()</a> but waits for a task to become available. The returned task will always be a valid pointer. <br /></td></tr>
<tr class="separator:ab16759130d189765b67679239cc84401"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a608f2e9a691181e5eb471168242f90"><td class="memItemLeft" align="right" valign="top"><a id="a6a608f2e9a691181e5eb471168242f90"></a>
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a6a608f2e9a691181e5eb471168242f90">size</a> () const</td></tr>
<tr class="memdesc:a6a608f2e9a691181e5eb471168242f90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current total size of the pool (sum of idle and busy tasks) <br /></td></tr>
<tr class="separator:a6a608f2e9a691181e5eb471168242f90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00cfcbc2ddc5054dc07e7ef1eabdcce1"><td class="memItemLeft" align="right" valign="top"><a id="a00cfcbc2ddc5054dc07e7ef1eabdcce1"></a>
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a00cfcbc2ddc5054dc07e7ef1eabdcce1">minimum_size</a> () const</td></tr>
<tr class="memdesc:a00cfcbc2ddc5054dc07e7ef1eabdcce1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the minimum size of the pool. <br /></td></tr>
<tr class="separator:a00cfcbc2ddc5054dc07e7ef1eabdcce1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af10a82a436ba698b6b3435766f16d6be"><td class="memItemLeft" align="right" valign="top"><a id="af10a82a436ba698b6b3435766f16d6be"></a>
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#af10a82a436ba698b6b3435766f16d6be">maximum_size</a> () const</td></tr>
<tr class="memdesc:af10a82a436ba698b6b3435766f16d6be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximum size of the pool. <br /></td></tr>
<tr class="separator:af10a82a436ba698b6b3435766f16d6be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae40d2f80c2cd865e7710bb88122e533a"><td class="memItemLeft" align="right" valign="top"><a id="ae40d2f80c2cd865e7710bb88122e533a"></a>
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#ae40d2f80c2cd865e7710bb88122e533a">idle_count</a> () const</td></tr>
<tr class="memdesc:ae40d2f80c2cd865e7710bb88122e533a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of idle tasks in the pool. <br /></td></tr>
<tr class="separator:ae40d2f80c2cd865e7710bb88122e533a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc1533410c3cadd6ef5a88d4b3b94ccc"><td class="memItemLeft" align="right" valign="top"><a id="adc1533410c3cadd6ef5a88d4b3b94ccc"></a>
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#adc1533410c3cadd6ef5a88d4b3b94ccc">busy_count</a> () const</td></tr>
<tr class="memdesc:adc1533410c3cadd6ef5a88d4b3b94ccc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of busy tasks in the pool. <br /></td></tr>
<tr class="separator:adc1533410c3cadd6ef5a88d4b3b94ccc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55d6d8f09884697196c398d1aa6e17e8"><td class="memItemLeft" align="right" valign="top"><a id="a55d6d8f09884697196c398d1aa6e17e8"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a55d6d8f09884697196c398d1aa6e17e8">resize</a> (std::size_t new_size)</td></tr>
<tr class="memdesc:a55d6d8f09884697196c398d1aa6e17e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resizes the task pool to the given new size if possible. <br /></td></tr>
<tr class="separator:a55d6d8f09884697196c398d1aa6e17e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b4688d6d2387834b033084a00fe632e"><td class="memItemLeft" align="right" valign="top"><a id="a8b4688d6d2387834b033084a00fe632e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtranswarp_1_1task__pool.html#a8b4688d6d2387834b033084a00fe632e">reclaim</a> ()</td></tr>
<tr class="memdesc:a8b4688d6d2387834b033084a00fe632e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reclaims finished tasks by marking them as idle again. <br /></td></tr>
<tr class="separator:a8b4688d6d2387834b033084a00fe632e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename ResultType&gt;<br />
class transwarp::task_pool&lt; ResultType &gt;</h3>

<p>A task pool that allows running multiple instances of the same task in parallel. </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>include/<a class="el" href="transwarp_8h_source.html">transwarp.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
